package fab.forms 
{
	import fab.forms.fields.CheckBoxElement;
	import fab.forms.fields.Element;
	import fab.forms.fields.InputTextElement;
	import fl.controls.CheckBox;
	import fl.controls.RadioButton;
	import flash.display.DisplayObject;
	import flash.text.TextField;
	/**
	 * ...
	 * @author fab
	 */

	public class FormUtils
	{
		static public const CHECKBOX:String = "checkbox";
		static public const RADIOBUTTON:String = "radiobutton";
		static public function replaceComposant(...args):void
		{
			var dummy:DisplayObject = args[1];
			switch ( args[0] )
			{
				case CHECKBOX:// add to library checkbox.swc design pour ce projet
				var cb:CheckBox = new CheckBox();
				cb.name = dummy.name;
				if ( args[2] ) rb.label = args[2]; else cb.label = "";
				cb.x = dummy.x;
				cb.y = dummy.y;
				dummy.parent.addChild( cb );
				dummy.parent.removeChild( dummy );
				break;
				
				case RADIOBUTTON:// add to library radiobutton.swc design pour ce projet
				var rb:RadioButton = new RadioButton();
				rb.name = dummy.name;
				if ( args[2] ) rb.label = args[2]; else rb.label = "";
				rb.x = dummy.x;
				rb.y = dummy.y;
				dummy.parent.addChild( rb );
				dummy.parent.removeChild( dummy );
				break;					
			}
		}		
    }	
}